﻿//Copyright (c) Microsoft Corporation.  All rights reserved.

using Microsoft.Ted.Wacel.Base;
using Microsoft.Ted.Wacel.TableStorage;
using System;

namespace Microsoft.Ted.Wacel.TableStorage
{
    public class Cube:Base.Cube
    {
        public Cube(string name, string connectionString)
            : base(name,
                new MasterDetails<string, string>(name + "batches",
                    new TableStorageDataProvider<string>(connectionString, name + "batches", partitionField: "Partition") {Configuration = new TableStorageConfiguration()},
                    new TableStorageLockProvider(connectionString, name + "batchlocks")),
                new TableStorageDataProvider<NodeData>(connectionString, name) {Configuration = new TableStorageConfiguration { WriteBatchSize = 1 }},
                new TableStorageLockProvider(connectionString, name + "locks"))
        {

        }
        public static Cube GetSimpleCube(string connectionString)
        {
            Cube ret = new Cube("simplecube", connectionString);
            ret.AddDimension(Dimension.GetTimeDimensionMonthDays(DateTime.Now.Year));
            return ret;
        }
    }
}
